package com.hxx.common.core.wcontour;

import com.hxx.common.core.wcontour.base.TrainData;
import com.hxx.common.core.wcontour.enums.TempColorEnum;
import com.hxx.common.core.wcontour.read.TempJsonUtil;
import com.hxx.common.core.wcontour.util.CoordConverUtil;
import com.hxx.common.core.wcontour.util.GeoHeatUtil;

import java.io.File;
import java.io.IOException;

/**
 * 热力图数据测试类
 */
public class TestGeoHeat {
    
    public static void main(String[] args) throws IOException {
        long startTime = System.currentTimeMillis();
        System.out.println("开始执行");

        String pngPath = "/Users/***/test/test/states.png";

        // 根据shapefile生成模版png
//        String shapefile = "/Users/***/Downloads/地市边界线/地市边界线.shp";
//        GeoImageUtil.shpToPng(shapefile, pngPath);

        // 气象温度json数据,等值面裁切shp文件路径
        String jsonFile = "/Users/***/工作/绘天/气象项目/温度12小时/2022090116.json";
        String outPaht = "/Users/***/test/test/temp_all_png.png";
        TrainData trainData = TempJsonUtil.readJson(new File(jsonFile));
        CoordConverUtil.converX(trainData);
//        GeoHeatUtil.gridToPng(trainData, TempColorEnum.getValueColorMap(), outPaht);
        GeoHeatUtil.gridToPng(trainData, TempColorEnum.getValueColorMap(), pngPath, outPaht);

        // 读取雷达bin文件
//        String outPaht = "/Users/***/test/test/radar_all_png.png";
//        String radarBinPath = "/Users/***/工作/绘天/气象项目/Radar-2022-09-23-14时左右/Z_OTHE_RADAMCR_20220923062400.bin";
//        TrainData trainData = RadarBinUtil.read(new File(radarBinPath));
//        CoordConverUtil.converY(trainData);
//        CoordConverUtil.converDataXY(trainData);
//        GeoHeatUtil.gridToPng(trainData, RadarColorEnum.getValueColorMap(), outPaht);

        System.out.println(String.format("完成任务，共花时：%s", System.currentTimeMillis() - startTime));

    }
}
